using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using System.Xml.Xsl;
using System.Text;
using System.IO;

public partial class browse : CMSPageBase
{
    XsltArgumentList xArguments = null;
    XslCompiledTransform xPageTransform = null;

    protected override void OnInit(EventArgs e)
    {
        StringBuilder sb = new StringBuilder();
        StringWriter sw = new StringWriter(sb);
        xArguments = new XsltArgumentList();
        string xTransform = "";

        xTransform = Server.MapPath(Request.ApplicationPath) + "\\xsl\\category.xsl";
        xArguments.AddParam("rootUrl", "", Request.ApplicationPath.TrimEnd('/') + "/");

        if (mWebsite.SubFolderName == "collisstudios") // TODO: fix this awful hack
        {
            xArguments.AddParam("desiredThumbnailWidth", "", 150);
            xArguments.AddParam("desiredThumbnailHeight", "", 150);
        }

        if (mWebsite != null)
        {
            mCustomer = mWebsite.Customer;

            XsltSettings settings = new XsltSettings(false, true);

            //context.Response.Write("website is " + website.Title + "<br/>");
            string xmlUri = Web2Xml.getWebsiteXml(((CMSPageBase)Page).Website.ID);
            xPageTransform = new XslCompiledTransform();
            xPageTransform.Load(xTransform, settings, new XmlUrlResolver());

            xPageTransform.Transform(xNav, xArguments, sw);
            sw.Close();

            litContent.Text = Server.HtmlDecode(Server.HtmlDecode(sw.ToString()));
        }

        base.OnInit(e);
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
